home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / NextAnswers / 1422_sending_postscript_to_WindowServer.rtf < prev    next >
Text File  |  1993-11-08  |  1KB  |  41 lines

  1. {\rtf0\ansi{\fonttbl\f0\fnil Times-Roman;\f2\fmodern Courier;\f1\fmodern Ohlfs;}
  2. \paperw12060
  3. \paperh10920
  4. \margl120
  5. \margr120
  6. {\colortbl;\red0\green0\blue0;}
  7. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\b0\i0\ulnone\fs28\fc0\cf0 Q:  How can I send a PostScript file directly to the 
  8. \fc1\cf1 WindowServer?\
  9. \
  10. A: You should usually use NXImage.  However, if that's not appropriate in your situation use the following code snippet.  Warning: Do 
  11. \b not
  12. \b0  use 
  13. \b PSRun()
  14. \b0 , because your application may not work with -NXHost since the file you specified may not exist on the other machine.\
  15. \
  16.  
  17. \f2\fs24     int SendFileToPS(const char *fileName)\
  18.     \{\
  19.         NXStream *st;\
  20.         char *addr;\
  21.         int len, maxlen;\
  22. \
  23.         st = NXMapFile(fileName, NX_READONLY);\
  24.         if (st) \{\
  25.             NXGetMemoryBuffer(st, &addr, &len, &maxlen);\
  26.             DPSWriteData(DPSGetCurrentContext(), addr, len);\
  27.             NXCloseMemory(st, NX_FREEBUFFER);\
  28.             return 0;\
  29.         \} else\
  30.             return -1;\
  31.     \}\
  32.  
  33. \f0\fs28\fc0\cf0 \
  34.  
  35. \fc1\cf1 \
  36. QA798\
  37. \
  38. Valid for 1.0, 2.0, 3.0, 3.1\
  39. \
  40.  
  41.